<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Frame Embed Page</title>
        
        <!-- The stylesheet -->
        <link href="{{bootstrap_css}}" rel="stylesheet">
        <link href="{{framewarp_css}}" rel="stylesheet">
        <link href="{{utils_css}}" rel="stylesheet">
        <link href="{{cloud_css}}" rel="stylesheet">

        <!--[if lt IE 9]>
          <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>
    
    <body class="framePage">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <form action="/poster/{{template_id}}{% if pid %}?pid={{pid}}&ret={{ret}}{% elif ret %}?ret={{ret}}{% endif %}/"
                           method="POST" id="post_form">
                        {{post_content}}
                    <button type="submit" id="post_submit" class="btn btn-primary">Save</button>
                </div>
                </form>
            </div>
        </div>
        <script src="{{jquery_js}}"></script>
        <script src="{{bootstrap_js}}"></script>
        <script src="{{japp_js}}"></script>
        <script src="{{utils_js}}"></script>
        <script src="{{framewarp_js}}"></script>
        <script src="{{cloud_js}}"></script>
        <script>
        {% if updated %}
        hide_frame();
        {% endif %}
        var obj;
        {% for item in items %}
        obj = document.getElementsByName({{item.name}});
        if (obj.length == 1){
            if (obj[0].type == "checkbox")
                obj[0].checked = true;
            else
                obj[0].value = {{item.value}};
        }
        else{
            for (var i=0; i< obj.length; i++){
                if (obj[i].type == "radio" && obj[i].value == {{item.value}})
                    obj[i].checked = true;
            }
        }
        {% endfor %}
        </script>
    </body>
</html>